package gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JLabel;

import javax.swing.JButton;
import javax.swing.WindowConstants;


public class Proveedores extends javax.swing.JFrame {

	private static final long serialVersionUID = 1L;
	private JLabel lblTitle;
	private JButton cmdVerProveedores;
	private JButton cmdActualizarProveedor;
	private JButton cmdBajaProveedor;
	private JButton cmdVolver;
	private JButton cmdAltaProveedor;
	private static Proveedores instance;
	
	private Proveedores() {
		super();
		initGUI();
		this.setLocationRelativeTo(null);
	}
	
	public static Proveedores getInstance()
	{
		if (instance == null)
			instance = new Proveedores();
		
		return instance;
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
			{
				lblTitle = new JLabel();
				getContentPane().add(lblTitle);
				lblTitle.setText("CPR - Proveedores");
				lblTitle.setFont(new java.awt.Font("Calibri",0,20));
				lblTitle.setBounds(12, 12, 162, 32);
			}
			{
				cmdAltaProveedor = new JButton();
				getContentPane().add(cmdAltaProveedor);
				cmdAltaProveedor.setText("Alta Proveedor");
				cmdAltaProveedor.setBounds(228, 91, 165, 31);
				cmdAltaProveedor.setFont(new java.awt.Font("Calibri",0,16));
				cmdAltaProveedor.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						cmdAltaProveedorActionPerformed(evt);
					}
				});
			}
			{
				cmdVolver = new JButton();
				getContentPane().add(cmdVolver);
				cmdVolver.setText("Volver");
				cmdVolver.setBounds(24, 319, 91, 31);
				cmdVolver.setFont(new java.awt.Font("Calibri",0,16));
				cmdVolver.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						cmdVolverActionPerformed(evt);
					}
				});
			}
			{
				cmdBajaProveedor = new JButton();
				getContentPane().add(cmdBajaProveedor);
				cmdBajaProveedor.setText("Eliminar Proveedor");
				cmdBajaProveedor.setBounds(228, 131, 165, 31);
				cmdBajaProveedor.setFont(new java.awt.Font("Calibri",0,16));
				cmdBajaProveedor.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						cmdBajaProveedorActionPerformed(evt);
					}
				});
				}
			{
				cmdActualizarProveedor = new JButton();
				getContentPane().add(cmdActualizarProveedor);
				cmdActualizarProveedor.setText("Actualizar Proveedor");
				cmdActualizarProveedor.setBounds(228, 171, 165, 31);
				cmdActualizarProveedor.setFont(new java.awt.Font("Calibri",0,16));
			}
			{
				cmdVerProveedores = new JButton();
				getContentPane().add(cmdVerProveedores);
				cmdVerProveedores.setText("Ver Proveedores");
				cmdVerProveedores.setBounds(228, 211, 165, 31);
				cmdVerProveedores.setFont(new java.awt.Font("Calibri",0,16));
				cmdVerProveedores.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						cmdVerProveedoresProveedorActionPerformed(evt);
					}
				});
			}
			pack();
			setSize(600, 400);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private void cmdVolverActionPerformed(ActionEvent evt) {
		this.dispose();
	}
	
	private void cmdAltaProveedorActionPerformed(ActionEvent evt) {
		AltaProveedor inst = AltaProveedor.getInstance();
		inst.setVisible(true);
	}
	
	private void cmdBajaProveedorActionPerformed(ActionEvent evt) {
		BajaProveedor inst = BajaProveedor.getInstance();
		inst.setVisible(true);
	}
	
	private void cmdVerProveedoresProveedorActionPerformed(ActionEvent evt) {
		VerProveedores inst = VerProveedores.getInstance();
		inst.setVisible(true);
	}
}
